from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class Base():
    def __init__(self):
        cap={
            "platformName": "Android",
            "deviceName": "127.0.0.1:7555",
            "noReset": True,
            "appPackage": "cn.xuexi.android",
            "appActivity": "com.alibaba.android.rimet.biz.home.activity.HomeActivity"
        }
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
        self.driver.implicitly_wait(20)
    def tc(self):
        self.driver.quit()
    def find_ele_(self,loc):
        ele=self.driver.find_element(*loc)
        return ele
    def dd(self,loc):
        ele=WebDriverWait(self.driver,10).until(EC.element_to_be_clickable(loc))
        return ele
    def jp(self,a):
        self.driver.save_screenshot(a)
